Fundamentals and Essentials of Data Structure & Algorithms: Master well-defined standards for writing algorithms by Zamsprin Publications

Fundamentals and Essentials of Data Structure & Algorithms: Master well-defined standards for writing algorithms by Zamsprin Publications

Author:Zamsprin Publications
Language: eng
Format: epub
Published: 2020-11-12T00:00:00+00:00


Runtime complexity of interpolation search algorithm is Ο(log (log n)) as compared to Ο(log n) of BST in favorable situations.

Algorithm

As it is an improvisation of the existing BST algorithm, we are mentioning the steps to search the 'target' data value index, using position probing −

Step 1 − Start searching data from middle of the list.

Step 2 − If it is a match, return the index of the item, and exit.

Step 3 − If it is not a match, probe position.

Step 4 − Divide the list using probing formula and find the new midle.

Step 5 − If data is greater than middle, search in higher sub-list.

Step 6 − If data is smaller than middle, search in lower sub-list.

Step 7 − Repeat until match.

Pseudocode

A → Array list

N → Size of A

X → Target Value



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.